/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package QuanLyThuoc;

import QuanLyLoaiThuoc.LoaiThuoc;
import QuanLyNhaCungCap.NhaCungCap;
import java.sql.SQLException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author PhuongNga
 */
public class DanhSachThuoc extends javax.swing.JPanel {

    private DefaultTableModel modelThuoc = new DefaultTableModel();
    LoaiThuoc lt = new LoaiThuoc();
    NhaCungCap ncc = new NhaCungCap();
    Vector vLay = new Vector();

    public DanhSachThuoc() {
        initComponents();

        try {
            vLay = Thuoc.xemDanhSachThuoc();
            this.taiDanhSachThuoc(vLay);

            vLay = NhaCungCap.layTenNhaCungCap();
            layTenNhaCungCap(vLay);

            vLay = LoaiThuoc.xemTenLoaiThuoc();
            layTenLoaiThuoc(vLay);
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    //Tải bảng lên

    public void taiDanhSachThuoc(Vector vLay) throws SQLException {
        modelThuoc.setRowCount(0);
        Vector cotThuoc = new Vector();
        cotThuoc.addElement("Mã");
        cotThuoc.addElement("Tên thuốc");
        cotThuoc.addElement("Loai thuốc");
        cotThuoc.addElement("Nhà cung cấp");
        cotThuoc.addElement("Đơn vị tính");
        cotThuoc.addElement("Giá");
        cotThuoc.addElement("Hạn SD");
        cotThuoc.addElement("Công dụng");
        modelThuoc.setColumnIdentifiers(cotThuoc);

        Thuoc t = new Thuoc();
        for (int i = 0; i < vLay.size(); i++) {
            t = (Thuoc) vLay.get(i);

            Vector hangThuoc = new Vector();
            hangThuoc.addElement(t.getMaThuoc());
            hangThuoc.addElement(t.getTenThuoc());
            hangThuoc.addElement(t.getTenLoaiThuoc());
            hangThuoc.addElement(t.getTenNhaCungCap());
            hangThuoc.addElement(t.getTenDonViTinh());
            hangThuoc.addElement(t.getGia());
            hangThuoc.addElement(t.getHanDung());
            hangThuoc.addElement(t.getCongDung());
            modelThuoc.addRow(hangThuoc);

        }
        tbDanhSachThuoc.setModel(modelThuoc);
    }
    //Lấy mã Loại thuốc

    public void layTenLoaiThuoc(Vector vLay) {
        Vector loaiThuoc = new Vector();
        loaiThuoc.addElement("---Chọn loại thuốc---");
        for (int i = 0; i < vLay.size(); i++) {
            lt = (LoaiThuoc) vLay.get(i);
            loaiThuoc.addElement(lt.getTenLoaiThuoc());
        }
        DefaultComboBoxModel modelLoaiThuoc = new DefaultComboBoxModel(loaiThuoc);
        cbLoaiThuoc.setModel(modelLoaiThuoc);
    }

    //Lấy tên nhà cung cấp
    public void layTenNhaCungCap(Vector vLay) {
        Vector nhaCungCap = new Vector();
        nhaCungCap.addElement("---Chọn Nhà cung cấp---");
        for (int i = 0; i < vLay.size(); i++) {
            ncc = (NhaCungCap) vLay.get(i);

            nhaCungCap.addElement(ncc.getTenNhaCungCap());
        }
        DefaultComboBoxModel modelNCC = new DefaultComboBoxModel(nhaCungCap);
        cbNhaCungCap.setModel(modelNCC);
    }

    //Xóa thuốc
    public void xoaThuoc() {
         int r = tbDanhSachThuoc.getSelectedRow();
        if (r < 0) {
            JOptionPane.showMessageDialog(this, "Bạn chưa chọn mục để xóa", "Thông báo", JOptionPane.ERROR_MESSAGE);
            return;
        }
        int show = JOptionPane.showConfirmDialog(this, "Bạn có muốn xóa thuốc ?", "Thông báo", JOptionPane.YES_NO_OPTION);
        if (show == JOptionPane.YES_OPTION) {
            int kt = 0, dem = 0;
            int[] rArr = tbDanhSachThuoc.getSelectedRows();
            try {
                for (int i = 0; i < rArr.length; i++) {
                    int maThuoc = Integer.parseInt(tbDanhSachThuoc.getValueAt(rArr[i], 0).toString());
                    kt = Thuoc.xoaThuoc(maThuoc);
                    if (kt == 1) {
                        dem++;
                    }
                }
                if (dem > 0) {
                    JOptionPane.showMessageDialog(this, "Xóa " + dem + " thuốc", "Thông báo", JOptionPane.INFORMATION_MESSAGE);
                    vLay = Thuoc.xemDanhSachThuoc();
                    this.taiDanhSachThuoc(vLay);
                } else {
                    JOptionPane.showMessageDialog(this, "Xóa thuốc bị lỗi.Đếm = " + dem + " !", "Thông báo", JOptionPane.ERROR_MESSAGE);
                }
            } catch (SQLException ex) {
                System.err.println(ex.getMessage());
            }
        }
    }

    //Tìm kiếm thuốc-----------------------------------------------------------------------------------
    public void timKiemThuoc() throws SQLException {
        if (txtTenThuoc.getText().equals("") && cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
            JOptionPane.showMessageDialog(null, "Bạn phải chọn ít nhất một mục để tìm kiếm");
            return;
        }
        Vector vlist = new Vector();
        if (txtTenThuoc.getText() != "" && cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
            vlist.addElement(txtTenThuoc.getText().trim());
            vLay = Thuoc.timKiem("spTimKiemTenThuoc",vlist);
            this.taiDanhSachThuoc(vLay);
        } else if (txtTenThuoc.getText() != "" && !cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
            vlist.addElement(txtTenThuoc.getText().trim());
            vlist.addElement(cbLoaiThuoc.getSelectedItem().toString());
            vLay = Thuoc.timKiem("spTimKiemTen_LoaiThuoc_Thuoc",vlist);
            this.taiDanhSachThuoc(vLay);
        } else if (txtTenThuoc.getText() != "" && cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && !cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
            vlist.addElement(txtTenThuoc.getText().trim());
            vlist.addElement(cbNhaCungCap.getSelectedItem().toString());
            vLay = Thuoc.timKiem("spTimKiemTen_NCC_Thuoc",vlist);
            this.taiDanhSachThuoc(vLay);
        }else if (txtTenThuoc.getText() != "" && !cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && !cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
            vlist.addElement(txtTenThuoc.getText().trim());
            vlist.addElement(cbLoaiThuoc.getSelectedItem().toString());
            vlist.addElement(cbNhaCungCap.getSelectedItem().toString());
            vLay = Thuoc.timKiem("spTimKiemTen_LoaiThuoc_NCC_Thuoc",vlist);
            this.taiDanhSachThuoc(vLay);
        }else if (txtTenThuoc.getText().equals("") && !cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
            vlist.addElement(cbLoaiThuoc.getSelectedItem().toString());
            vLay = Thuoc.timKiem("spTimKiemLoaiThuoc_Thuoc",vlist);
            this.taiDanhSachThuoc(vLay);
        }else if (txtTenThuoc.getText().equals("") && cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && !cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
            vlist.addElement(cbNhaCungCap.getSelectedItem().toString());
            vLay = Thuoc.timKiem("spTimKiemNhaCungCap_Thuoc",vlist);
            this.taiDanhSachThuoc(vLay);
        }else if (txtTenThuoc.getText().equals("") && !cbLoaiThuoc.getSelectedItem().toString().equals("---Chọn loại thuốc---") && !cbNhaCungCap.getSelectedItem().toString().equals("---Chọn Nhà cung cấp---")) {
             vlist.addElement(cbLoaiThuoc.getSelectedItem().toString());
            vlist.addElement(cbNhaCungCap.getSelectedItem().toString());
            vLay = Thuoc.timKiem("spTimKiemLoaiThuoc_NCC_Thuoc",vlist);
            this.taiDanhSachThuoc(vLay);
        }
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbDanhSachThuoc = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtTenThuoc = new javax.swing.JTextField();
        cbLoaiThuoc = new javax.swing.JComboBox();
        cbNhaCungCap = new javax.swing.JComboBox();
        btTimKiem = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        btCapNhat = new javax.swing.JButton();
        btThem = new javax.swing.JButton();
        btHuyBo = new javax.swing.JButton();
        btXoa = new javax.swing.JButton();

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Danh Sách Thuốc"));

        tbDanhSachThuoc.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(tbDanhSachThuoc);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 968, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel1.setText("Tên Thuốc");

        cbLoaiThuoc.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbLoaiThuoc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbLoaiThuocActionPerformed(evt);
            }
        });

        cbNhaCungCap.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cbNhaCungCap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbNhaCungCapActionPerformed(evt);
            }
        });

        btTimKiem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Anh/Search.png"))); // NOI18N
        btTimKiem.setText("Tìm kiếm");
        btTimKiem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btTimKiemActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtTenThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(cbLoaiThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(56, 56, 56)
                .addComponent(cbNhaCungCap, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
                .addComponent(btTimKiem, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtTenThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbLoaiThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbNhaCungCap, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btTimKiem, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(19, 19, 19))
        );

        btCapNhat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Anh/update.png"))); // NOI18N
        btCapNhat.setText("Cập Nhật");
        btCapNhat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCapNhatActionPerformed(evt);
            }
        });

        btThem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Anh/add 1.png"))); // NOI18N
        btThem.setText("Thêm");
        btThem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btThemActionPerformed(evt);
            }
        });

        btHuyBo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Anh/cross.png"))); // NOI18N
        btHuyBo.setText("Hủy bỏ");
        btHuyBo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btHuyBoActionPerformed(evt);
            }
        });

        btXoa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Anh/cross.png"))); // NOI18N
        btXoa.setText("Xóa");
        btXoa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btXoaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(btThem, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35)
                .addComponent(btCapNhat, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(50, 50, 50)
                .addComponent(btXoa, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47)
                .addComponent(btHuyBo, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(185, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btThem, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btXoa, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btHuyBo, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btCapNhat, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(26, 26, 26))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(140, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void cbLoaiThuocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbLoaiThuocActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cbLoaiThuocActionPerformed

    private void btThemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btThemActionPerformed

        new ThemThuoc().setVisible(true);
    }//GEN-LAST:event_btThemActionPerformed

    private void btCapNhatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCapNhatActionPerformed
        // TODO add your handling code here:
        new CapNhat().setVisible(true);
    }//GEN-LAST:event_btCapNhatActionPerformed

    private void btXoaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btXoaActionPerformed
        // TODO add your handling code here:
        this.xoaThuoc();
    }//GEN-LAST:event_btXoaActionPerformed

    private void btTimKiemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTimKiemActionPerformed
        try {
            // TODO add your handling code here:
            this.timKiemThuoc();
        } catch (SQLException ex) {
            Logger.getLogger(DanhSachThuoc.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btTimKiemActionPerformed

    private void btHuyBoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btHuyBoActionPerformed
        try {
            // TODO add your handling code here:
            txtTenThuoc.setText("");
            cbLoaiThuoc.setSelectedItem("---Chọn loại thuốc---");
            cbNhaCungCap.setSelectedItem("---Chọn Nhà cung cấp---");
            vLay = Thuoc.xemDanhSachThuoc();
                this.taiDanhSachThuoc(vLay);
        } catch (SQLException ex) {
            Logger.getLogger(DanhSachThuoc.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btHuyBoActionPerformed

    private void cbNhaCungCapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbNhaCungCapActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cbNhaCungCapActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btCapNhat;
    private javax.swing.JButton btHuyBo;
    private javax.swing.JButton btThem;
    private javax.swing.JButton btTimKiem;
    private javax.swing.JButton btXoa;
    private javax.swing.JComboBox cbLoaiThuoc;
    private javax.swing.JComboBox cbNhaCungCap;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tbDanhSachThuoc;
    private javax.swing.JTextField txtTenThuoc;
    // End of variables declaration//GEN-END:variables
}
